package com.erp.system.service.impl;

import com.erp.system.domain.MaterialVendor;
import com.erp.system.mapper.MaterialVendorMapper;
import com.erp.system.service.MaterialVendorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * FileName: MaterialVendorServiceImpl.java
 * 业务层接口实现类的详细说明
 *
 * @author 类创建者姓名
 * @version 1.00
 * @Date 创建日期
 */
@Service
public class MaterialVendorServiceImpl implements MaterialVendorService {

    @Autowired
    private MaterialVendorMapper materialVendorMapper;

    @Override
    public List<MaterialVendor> queryByMaterialId(String materialId) {
        MaterialVendor param = new MaterialVendor();
        param.setMaterialId(materialId);
        return queryAll(param);
    }

    @Override
    public List<MaterialVendor> queryAll(MaterialVendor materialVendor) {
        return materialVendorMapper.queryAll(materialVendor);
    }

    @Override
    public int insert(MaterialVendor materialVendor) {
        return materialVendorMapper.insert(materialVendor);
    }

    @Override
    public int update(MaterialVendor materialVendor) {
        return materialVendorMapper.update(materialVendor);
    }

    @Override
    public int delete(String[] ids) {
        return materialVendorMapper.delete(ids);
    }

    @Override
    public MaterialVendor queryById(String id) {
        MaterialVendor param = new MaterialVendor();
        param.setId(id);
        return queryAll(param).stream().findFirst().orElse(param);
    }
}
